module.exports = function (sequelize, DataTypes) {

  const student = sequelize.define('student', {
    id: {
        type: DataTypes.STRING(50),
        primaryKey: true
    },
    name: DataTypes.STRING(100),
    bedroom: DataTypes.STRING(50),
    gender: DataTypes.STRING(5),
    QQ: DataTypes.STRING(12),
    tel: DataTypes.STRING(12),
    status: DataTypes.STRING(100),
    class: DataTypes.STRING(50),
    idcard: DataTypes.STRING(50),
    permission: DataTypes.STRING(30),
    cookie: DataTypes.STRING(100),
    nationality: DataTypes.STRING(30),
    department: DataTypes.STRING(50)
  }, 
  {
      timestamps: false
  });
  student.associate = (models)=>{
    student.hasMany(models.signinrecord, {
      as: 'signinrecords'
    }),
    student.hasMany(models.prize, {
      as: 'prizes'
    })
  }
  return student;
}